package com.youth.youthservice.mapper;

import com.youth.youthservice.entity.EduSubject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youth.youthservice.entity.vo.CourseVo.SubjectParam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 课程科目 Mapper 接口
 * </p>
 *
 * @author CM
 * @since 2023-5-19
 */
public interface EduSubjectMapper extends BaseMapper<EduSubject> {

    @Select("select id,title,sort from edu_subject where parent_id = 0")
    List<SubjectParam> getOneLevelSubjects();

//    查询所有子科目id
    @Select("select id from edu_subject where parent_id = #{parentId}")
    List<String> listChildrenIds(@Param("parentId") String parentId);
}
